package com.third.share.umeng.tencent;

import android.app.Activity;

import com.dg.acb.utils.configdata.XXConstants;
import com.third.login.ThirdLoginPlatform;
import com.third.share.ShareData;
import com.third.share.umeng.Defaultcontent;
import com.third.share.umeng.StyleUtil;
import com.third.share.umeng.UMThirdShareBase;
import com.umeng.socialize.Config;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.ShareAction;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMMin;
//com.third.share.umeng.tencent.UWeiXinShare
public class UWeiXinShare extends UMThirdShareBase{

	public UWeiXinShare(Activity act) {
		super(act);
		// TODO Auto-generated constructor stub
	}
	protected void init(){
		mPlatform = ThirdLoginPlatform.WEIXIN;
		mShareMedia = SHARE_MEDIA.WEIXIN;
		mStyleList.add(StyleUtil.TEXT);
		mStyleList.add(StyleUtil.IMAGELOCAL);
		mStyleList.add(StyleUtil.IMAGEURL);
		mStyleList.add(StyleUtil.WEB11);
		mStyleList.add(StyleUtil.MUSIC11);
		mStyleList.add(StyleUtil.VIDEO11);
		mStyleList.add(StyleUtil.EMOJI);
		mStyleList.add(StyleUtil.MINAPP);
		Config.DEBUG = true;
		PlatformConfig.setWeixin(XXConstants.appKeyWeiXin, XXConstants.appSecretWeiXin);
	}

	@Override
	public void thirdShare(ShareData shareData) {
		// TODO Auto-generated method stub
		mPlatform = shareData.mThirdSharePlatform;
		if(mPlatform == ThirdLoginPlatform.WEIXIN_CIRCLE){
			mShareMedia = SHARE_MEDIA.WEIXIN_CIRCLE;

		}else if(mPlatform == ThirdLoginPlatform.WEIXIN){
			mShareMedia = SHARE_MEDIA.WEIXIN;
		}else{
			return;
		}
		switch(shareData.mShareStyle){
			case StyleUtil.TEXT:
				 new ShareAction(mActivity).withText(Defaultcontent.text)
                 .setPlatform(mShareMedia)
                 .setCallback(mUMThirdShareListener).share();
				break;
			case StyleUtil.TEXTANDIMAGE:
				 new ShareAction(mActivity).withText(Defaultcontent.text)
				 .withMedia(mImagelocal)
                 .setPlatform(mShareMedia)
                 .setCallback(mUMThirdShareListener).share();
				break;
			case StyleUtil.IMAGELOCAL:
				 new ShareAction(mActivity).withMedia(mImagelocal)
                 .setPlatform(mShareMedia)
                 .setCallback(mUMThirdShareListener).share();
				break;
			case StyleUtil.IMAGEURL:
				shareImage(shareData);
				break;
			case StyleUtil.WEB11:
				 new ShareAction(mActivity)
                 .withText(Defaultcontent.text)
                 .withMedia(mWeb)
                 .setPlatform(mShareMedia)
                 .setCallback(mUMThirdShareListener).share();
				break;
			case StyleUtil.EMOJI:
				  new ShareAction(mActivity)
                  .withMedia(mEmoji)
                  .setPlatform(mShareMedia)
                  .setCallback(mUMThirdShareListener).share();
				break;
			case StyleUtil.VIDEO11:
				shareVideo(shareData);
				break;
			case StyleUtil.MINAPP:
				  UMMin umMin = new UMMin(Defaultcontent.url);
                  umMin.setThumb(mImagelocal);
                  umMin.setTitle(Defaultcontent.title);
                  umMin.setDescription(Defaultcontent.text);
                  umMin.setPath("pages/page10007/page10007");
                  umMin.setUserName("gh_3ac2059ac66f");
                  new ShareAction(mActivity)
                       .withMedia(umMin)
                          .setPlatform(mShareMedia)
                          .setCallback(mUMThirdShareListener).share();
				break;
		}
	}

}
